//
//  YFNetworkingService.h
//  CoollangTennisBall
//
//  Created by Coollang on 2018/1/12.
//  Copyright © 2018年 Coollang-YF. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
#import <Qiniu/QiniuSDK.h>
#import "YFCheckNetworkStatus.h"
#import "YFNetError.h"
#import "YFBaseRequest.h"

extern NSString * const QiNiuErrorDomainCustom;

typedef enum : NSUInteger {
    kQiNiuErrorCodeUplaodImageFail = -1002,
    kQiNiuErrorCodeGetTokenFail = -1001,
} kQiNiuErrorCode;

typedef void(^YFNetworkingServiceBlock)(BOOL success,id result,NSError *error);

typedef void(^DownloadCompletionBlock)(NSURLResponse *response, NSURL *filePath, NSError *error);

@interface YFNetworkingService : NSObject
/**单例*/
+ (instancetype)sharedInstance;

+ (QNUploadManager *)qNUploadManager;

-(void)configureBaseUrl;
- (void)cancelRequest:(YFBaseRequest *)request;
// 配置缓存
- (void)setUpRequestCacheFiltersWithUserId:(NSString *)userId;

/**
 *  普通请求
 *
 *  @param request 请求API
 *  @param block   回调
 */
-(void)sendRequest:(YFBaseRequest *)request callback:(YFNetworkingServiceBlock)block;

/**
 *  并发请求
 *
 *  @param requestArray 请求队列
 *  @param block        回调block
 */
-(void)sendBatch:(NSArray *)requestArray
        callback:(YFNetworkingServiceBlock)block;

- (void)performDownloadNewVersionWithPath:(NSString *)downloadPath downloadCompletionBlock:(DownloadCompletionBlock)block;

@end
